home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Information / CSMP Digest / volume 1 / csmp-v1-172.txt < prev    next >
Encoding:
Text File  |  1994-12-08  |  31.9 KB  |  779 lines  |  [TEXT/R*ch]

  1. C.S.M.P. Digest             Fri, 02 Oct 92       Volume 1 : Issue 172
  2.  
  3. Today's Topics:
  4.  
  5.     Selecting a line
  6.     What's a good asm reference book?
  7.     Superdrives reading weird IBM disks
  8.     Code to have a VBL watch over the cursor
  9.     Restricting PBCatSearch
  10.     init help
  11.     How to modify SFGet(Put)File buttons.
  12.  
  13.  
  14.  
  15. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  16.  
  17. The digest is a collection of article threads from the internet newsgroup
  18. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  19. regularly and want an archive of the discussions.  If you don't know what a
  20. newsgroup is, you probably don't have access to it.  Ask your systems
  21. administrator(s) for details.  (This means you can't post questions to the
  22. digest.)
  23.  
  24. Each issue of the digest contains one or more sets of articles (called
  25. threads), with each set corresponding to a 'discussion' of a particular
  26. subject.  The articles are not edited; all articles included in this digest
  27. are in their original posted form (as received by our news server at
  28. cs.uoregon.edu).  Article threads are not added to the digest until the last
  29. article added to the thread is at least one month old (this is to ensure that
  30. the thread is dead before adding it to the digest).  Article threads that
  31. consist of only one message are generally not included in the digest.
  32.  
  33. The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
  34. [128.223.8.8] in the directory /pub/mac/csmp-digest.  Be sure to read the
  35. file /pub/mac/csmp-digest/README before downloading any files.  The most
  36. recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
  37. directory /info-mac/digest/csmp.  If you don't have ftp capability, the sumex
  38. archive has a mail server; send a message with the text '$MACarch help' (no
  39. quotes) to LISTSERV@ricevm1.rice.edu for more information.
  40.  
  41. The digest is also available via email.  Just send a note saying that you
  42. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  43. automatically receive each new issue as it is created.  Sorry, back issues
  44. are not available through the mailing list.
  45.  
  46. Send administrative mail to mkelly@cs.uoregon.edu.
  47.  
  48.  
  49. -------------------------------------------------------
  50.  
  51. Organization: Carnegie Mellon, Pittsburgh, PA
  52. Date: Fri, 17 Jul 1992 16:50:20 -0400 
  53. From: Brian Campbell <bc2k+@andrew.cmu.edu>
  54. Subject: Selecting a line
  55.  
  56.    For a program (a graphical interface for a circuit simulator) that I
  57. am writing in Think C, icons can be connected to each other via a line
  58. which is defined by two points (one in each icon).  For the
  59. Cut/Copy/Paste features, I want to be able to click on a point on a line
  60. in order to select the line as well as the icons connected to it.  Is
  61. there an easy way to do this?  (I guess the question can also be phrased
  62. as: Is there a way to turn a line into an 'entity' ... similar to a
  63. region?).
  64.  
  65. Thanks in advance.
  66.  
  67.  
  68. ******************************************************************************
  69. Brian
  70. bc2k@andrew.cmu.edu (until 8/14)
  71. bjc2d@kelvin.seas.virginia.edu (permanent)
  72.  
  73. +++++++++++++++++++++++++++
  74.  
  75. From: smoke@well.sf.ca.us (Nicholas Jackiw)
  76. Organization: Whole Earth 'Lectronic Link
  77. Date: Fri, 17 Jul 1992 21:47:52 GMT
  78.  
  79. In article <8eNn_Aq00WBN85PV1W@andrew.cmu.edu> Brian Campbell <bc2k+@andrew.cmu.edu> writes:
  80. >   For a program (a graphical interface for a circuit simulator) that I
  81. >am writing in Think C, icons can be connected to each other via a line
  82. >which is defined by two points (one in each icon).  For the
  83. >Cut/Copy/Paste features, I want to be able to click on a point on a line
  84. >in order to select the line as well as the icons connected to it.  Is
  85. >there an easy way to do this?  (I guess the question can also be phrased
  86. >as: Is there a way to turn a line into an 'entity' ... similar to a
  87. >region?).
  88. >
  89. >Thanks in advance.
  90. >
  91. >******************************************************************************
  92. >Brian
  93. >bc2k@andrew.cmu.edu (until 8/14)
  94. >bjc2d@kelvin.seas.virginia.edu (permanent)
  95.  
  96.  
  97.  
  98. This is a repeat of an article I posted last year sometime.
  99. ========================================================
  100. This comes up about once a year.  The consensus is that there are two
  101. ways of doing it, each of which has its demagouges.
  102.  
  103. First, you can do it by an algebraic function.  If you have a line or
  104. a segment running through/between (X1,Y1) and (X2,Y2), and the mouse
  105. is at (Xm,Ym), then the distance from the mouse to
  106. the line or segment is less than k units iff
  107.  
  108.      [(dQ)(dX)-(dP)(dY)]^2 - k^2(dX^2+dY^2)<0
  109.  
  110. where dX=X2-X1; dY=Y2-Y1, dP=Xm-X1, and dQ=Ym-Y1.  You can see that the
  111. entire right-hand term (k-square times the sum of the squares of the
  112. deltas) is constant for any given line, and so needs to be computed only
  113. once (when the line is drawn), rather than every time through the selection
  114. loop.  The left-hand term results in three multiplications and one
  115. subtraction, which can be done entirely with integer arithmetic.
  116.  
  117. [Note: the above comparison assumes you're dealing with a line and not a
  118. segment (i. e. with infinite extension).  Simply check if (Xm,Ym) falls
  119. inside the bounding rect of the segment, if you want to alter it for
  120. segments.]
  121.  
  122. The advantage of this method is it's blindingly fast.  If you have a lot
  123. of objects, or require speed for other reasons (for instance, if you test
  124. whether an object's hit in your cursor-idle loop as well as in your
  125. mousedown response), it's the best.  Unfortunately, it doesn't generalize
  126. to other object types, so if you support circles, polygons, etc., you'll
  127. need separate math functions for each of them.
  128.  
  129.  
  130. The other method is very elegant and general, but comparatively slow.  In
  131. this method, you allocate an offscreen bitmap k units square (where k is
  132. again your general "distance-considered-close-enough-to-hit" constant)
  133. centered
  134. at (Xm,Ym).  Then you begin drawing your objects, from "front" to "back" if
  135. they aren't planar, one at a time, using this miniscule bitmap as your
  136. portBits.   After each object, check if Quickdraw has set to black any of
  137. the bits contained in the bitmap--if so, the last object drawn should be
  138. considered hit.
  139.  
  140. The advantage of this method is that it relies on Quickdraw to do all
  141. clipping for you, so you don't need to work out any math if you don't want;
  142. and it works equally well regardless of what type of object you draw:
  143. it's a general solution.  On the other hand, quick as Quickdraw may be,
  144. clipping and bit-writing an object will never be as fast as the few
  145. arithmetic operations required by the first solution.  By the time the
  146. trap dispatcher has located your LineTo()'s trap address in this method,
  147. the previous method will already have returned T or F.
  148.  
  149. It's up to you.  As a fan of the first method,  I'll say that functions or
  150. algorithms for all basic Mac-Draw-ish shapes..circles, ovals, segments, and
  151. arbitrary polygons--are well known, easy to implement, and fast.
  152. - -- 
  153.                               --- * ---
  154. Nick Jackiw                  Smoke@well.sf.ca.us   | Jackiw@cs.swarthmore.edu
  155. Key Curriculum Press, Inc.   Applelink:KEY.EDUSOFT | (510) 548-2304
  156.                               --- * ---
  157.  
  158. +++++++++++++++++++++++++++
  159.  
  160. From: ewylie@ocf.berkeley.edu (Elizabeth Wylie)
  161. Date: 18 Jul 92 18:56:57 GMT
  162. Organization: U.C. Berkeley Open Computing Facility
  163.  
  164. In article <BrJz7s.IKG@well.sf.ca.us> smoke@well.sf.ca.us (Nicholas Jackiw) writes:
  165. >The other method is very elegant and general, but comparatively slow.  In
  166. >this method, you allocate an offscreen bitmap k units square (where k is
  167. >again your general "distance-considered-close-enough-to-hit" constant)
  168. >centered
  169. >at (Xm,Ym).  Then you begin drawing your objects, from "front" to "back" if
  170. >they aren't planar, one at a time, using this miniscule bitmap as your
  171. >portBits.   After each object, check if Quickdraw has set to black any of
  172. >the bits contained in the bitmap--if so, the last object drawn should be
  173. >considered hit.
  174.  
  175. This is a very interesting way to deal with the problem.  I like it, but it
  176. won't really work for large hollow objects.  But for lines and little shapes
  177. like rasins, it is quite nice.  (And probably preferable for the rasin-selection
  178. algorithm.
  179.  
  180. :-o  Cool man.
  181.  
  182. - -E. Wylie
  183.  
  184. +++++++++++++++++++++++++++
  185.  
  186. From: lsr@taligent.com (Larry Rosenstein)
  187. Organization: Taligent, Inc.
  188. Date: Sun, 19 Jul 1992 00:31:06 GMT
  189.  
  190. In article <149phpINN8mo@agate.berkeley.edu>, ewylie@ocf.berkeley.edu
  191. (Elizabeth Wylie) wrote:
  192. > In article <BrJz7s.IKG@well.sf.ca.us> smoke@well.sf.ca.us (Nicholas Jackiw) writes:
  193. > >this method, you allocate an offscreen bitmap k units square (where k is
  194. > >again your general "distance-considered-close-enough-to-hit" constant)
  195. > >centered
  196. > This is a very interesting way to deal with the problem.  I like it, but it
  197. > won't really work for large hollow objects.  But for lines and little shapes
  198.  
  199. I don't see whay it wouldn't work for large hollow objects.  An important
  200. detail is that you have to draw the shapes with black rather than whatever
  201. color or pattern they may have on the screen.  So if you have a large
  202. hollow shape and want to detect click on the interior, you need to draw the
  203. interior with black.
  204.  
  205. Similarlry, if you wanted to detect a click on some text, you may want to
  206. just draw a black rectangle that represents the text's bounding box. 
  207. Otherwise the user will have to click right on some black pixel of a
  208. character.
  209.  
  210. Also, I don't know if you need to have a k unit square bitmap to handle the
  211. close-enough problem.  You can also draw the shapes slightly bigger to
  212. represent the close-enough distance.  Then you don't have to test as many
  213. bits in the offscreen bitmap.
  214.  
  215.  
  216. Larry Rosenstein
  217. Taligent, Inc.
  218.  
  219. lsr@taligent.com
  220.  
  221. ---------------------------
  222.  
  223. From: sichase@csa1.lbl.gov (SCOTT I CHASE)
  224. Subject: What's a good asm reference book?
  225. Date: 17 Jul 92 22:54:11 GMT
  226. Organization: Lawrence Berkeley Laboratory - Berkeley, CA, USA
  227.  
  228. I'm interested in making my first foray into inline assembly code in Think C 
  229. 5.0.  Is there a standard reference for 68030 assembly programming?  I have
  230. done some assembly programming on my VAX, so I don't need a primer.  Rather 
  231. I want something which is thorough and complete documentation of the 
  232. instruction set and how to use it.  Any suggestions?
  233.  
  234. Regards,
  235.  
  236. - -Scott
  237. - --------------------
  238. Scott I. Chase            "The question seems to be of such a character
  239. SICHASE@CSA2.LBL.GOV        that if I should come to life after my death
  240.                 and some mathematician were to tell me that it
  241.                 had been definitely settled, I think I would
  242.                 immediately drop dead again."      - Vandiver
  243.  
  244. +++++++++++++++++++++++++++
  245.  
  246. From: ewylie@ocf.berkeley.edu (Elizabeth Wylie)
  247. Date: 18 Jul 92 19:04:01 GMT
  248. Organization: U.C. Berkeley Open Computing Facility
  249.  
  250. In article <24669@dog.ee.lbl.gov> sichase@csa1.lbl.gov writes:
  251. >I'm interested in making my first foray into inline assembly code in Think C 
  252. >5.0.  Is there a standard reference for 68030 assembly programming?  I have
  253. >done some assembly programming on my VAX, so I don't need a primer.  Rather 
  254. >I want something which is thorough and complete documentation of the 
  255. >instruction set and how to use it.  Any suggestions?
  256. >
  257. >Regards,
  258. >
  259. >-Scott
  260.  
  261. My favorite is a well-thumbed copy of '68030 Assembly Language Reference' by
  262. Steve Williams.  It is published by Addison Wesley, ISBN 0-201-08876-2.
  263.  
  264. It goes for about 30 dollars and is about 750 pages.  It covers the 68000,
  265. 68010 (yawn), 68020 and 68030.  It describes the differences and how the
  266. caches work.  In the back it actually has some speed comparisons between
  267. some C compiled by MPW and some hand-coded assembly.  This book also covers
  268. the FPU and MMU instructions.
  269.  
  270. 'A must.' -REM "The Voice of Harold"
  271.  
  272. E. Wylie
  273. (Not associated with any of the above-named entities.  Not even REM)
  274.  
  275. ---------------------------
  276.  
  277. From: paul@cs.su.oz (Paul Craig Tyler)
  278. Subject: Superdrives reading weird IBM disks
  279. Date: 6 Jul 92 04:32:14 GMT
  280. Organization: Basser Dept of Computer Science, University of Sydney, Australia
  281.  
  282. I would like be able to read an IBM disk (from a non-IBM machine) that has 10
  283. sectors per track rather than 9 sectors.  ie., the formatting information is
  284. the same as an IBM disk but it has an extra sector per track.  I'm wondering
  285. whether it is going to be possible to read this format of disk.  Utilities
  286. like diskcopy read the disk as a 720K (9 sectors/track) disk, ignoring the
  287. 10th sector.  Is it possible to access the 10th sector or will it cause some
  288. error because the sector number is illegal?
  289.  
  290. Any information would be appreciated.  I don't want to spend lots of money
  291. on compilers etc only to find that I can't do this.
  292.  
  293. - --
  294. Paul Tyler       paul@cs.su.oz.au
  295. University of Sydney, Australia
  296.  
  297. +++++++++++++++++++++++++++
  298.  
  299. From: stevec@Apple.COM (Steve Christensen)
  300. Date: 18 Jul 92 03:15:03 GMT
  301. Organization: Apple Computer Inc., Cupertino, CA
  302.  
  303. paul@cs.su.oz (Paul Craig Tyler) writes:
  304. >I would like be able to read an IBM disk (from a non-IBM machine) that has 10
  305. >sectors per track rather than 9 sectors.  ie., the formatting information is
  306. >the same as an IBM disk but it has an extra sector per track.  I'm wondering
  307. >whether it is going to be possible to read this format of disk.  Utilities
  308. >like diskcopy read the disk as a 720K (9 sectors/track) disk, ignoring the
  309. >10th sector.  Is it possible to access the 10th sector or will it cause some
  310. >error because the sector number is illegal?
  311.  
  312. This type of question has been getting a lot of mention lately, so I'll
  313. summarize here.  The floppy disk driver in the Macintosh is designed to
  314. work with 400K GCR, 800K GCR, 720K MFM, and 1440K MFM floppy disks.  It
  315. will deal with no other disk formats.  There are no tables, parameters,
  316. etc., that can be tweaked, nor driver control/status calls that can be
  317. made to change this.  It is not a general purpose floppy driver; it's
  318. only designed to work with formats it knows about.
  319.  
  320. Several people have asked what it would take to be able to read other
  321. disk formats on the Mac.  I've typically said that you can either write
  322. your own driver or try to hack into the existing one.  In both cases,
  323. I know you'll have a tough time of trying to get this to work, and in
  324. a couple of Mac implementations, it's virtually impossible because of
  325. how the hardware is setup.  Also, Apple has no reason to keep using
  326. the current type of disk controller (it changed from the IWM to the
  327. SWIM in order to support MFM disks), since it will look for lower cost
  328. and/or better feature/performance solutions.
  329.  
  330. So the bottom line is that there's no support for what you want to do,
  331. it's a tough nut to crack, and if you want to pursue it, you're on
  332. your own...
  333.  
  334. steve
  335.  
  336. - -- 
  337. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  338.   Steve Christensen            Never hit a man with glasses.
  339.   stevec@apple.com            Hit him with a baseball bat.
  340.  
  341. ---------------------------
  342.  
  343. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  344. Subject: Code to have a VBL watch over the cursor
  345. Date: 15 Jul 92 18:26:32 +1200
  346. Organization: University of Waikato, Hamilton, New Zealand
  347.  
  348. In article <scott.711008283@mcl>, scott@mcl.ucsb.edu (Scott Bronson) describes
  349. a technique for using a VBL task to watch the modifier keys, so an application
  350. can call WaitNextEvent with a long sleep time and still wake up immediately
  351. to update the cursor when a modifier key changes state.
  352.  
  353. The idea of using a VBL task is good, but the one of posting an app1 event
  354. to wake up the process is not future-safe. I think Apple now reserves
  355. all the unused "low-level" event types for its own use.
  356.  
  357. Luckily, under System 7, there is a better way: you can call the Process
  358. Manager routine WakeUpProcess (IM6 page 29-20). And you can do this from
  359. interrupt level.
  360.  
  361. OK, so you want to remain compatible with System 6. I guess the best approach
  362. is to use the Process Manager call if it's available, otherwise fall back to
  363. posting an app1 event.
  364.  
  365. I mean, there's never going to be a System 6.1, right...?
  366.  
  367. Lawrence
  368. USENET DBRA specialist
  369.  
  370. +++++++++++++++++++++++++++
  371.  
  372. From: jcav@quads.uchicago.edu (JohnC)
  373. Organization: The Royal Society for Putting Things on Top of Other Things
  374. Date: Wed, 15 Jul 1992 15:37:18 GMT
  375.  
  376. In article <1992Jul15.182632.9388@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
  377. >In article <scott.711008283@mcl>, scott@mcl.ucsb.edu (Scott Bronson) describes
  378. >a technique for using a VBL task to watch the modifier keys, so an application
  379. >can call WaitNextEvent with a long sleep time and still wake up immediately
  380. >to update the cursor when a modifier key changes state.
  381. >
  382. >The idea of using a VBL task is good, but the one of posting an app1 event
  383. >to wake up the process is not future-safe. I think Apple now reserves
  384. >all the unused "low-level" event types for its own use.
  385.  
  386. It's worse than that.  As stated in TN180, under Multifinder/Process Manager
  387. there is only one low-level event queue (the place where _PostEvent puts
  388. events), and the events there are always passed to the frontmost process. This
  389. alone disallows the app1Evt technique, since by definition you'd be using it
  390. when your process was not frontmost.
  391.  
  392. - -- 
  393. John Cavallino                  |  EMail: jcav@midway.uchicago.edu
  394. University of Chicago Hospitals |         John_Cavallino@uchfm.bsd.uchicago.edu
  395. Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953
  396. B0 f++ c+ g+ k s++ e+ h- pv     |         Chicago, IL  60637
  397.  
  398. +++++++++++++++++++++++++++
  399.  
  400. From: scott@mcl.ucsb.edu (Scott Bronson)
  401. Date: 19 Jul 92 01:56:06 GMT
  402.  
  403. In <1992Jul15.153718.20128@midway.uchicago.edu> jcav@quads.uchicago.edu (JohnC) writes:
  404.  
  405. >In article <1992Jul15.182632.9388@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
  406. >>In article <scott.711008283@mcl>, scott@mcl.ucsb.edu (Scott Bronson) describes
  407. >>a technique for using a VBL task to watch the modifier keys, so an application
  408. >>can call WaitNextEvent with a long sleep time and still wake up immediately
  409. >>to update the cursor when a modifier key changes state.
  410. >>
  411. >>The idea of using a VBL task is good, but the one of posting an app1 event
  412. >>to wake up the process is not future-safe. I think Apple now reserves
  413. >>all the unused "low-level" event types for its own use.
  414.  
  415. >It's worse than that.  As stated in TN180, under Multifinder/Process Manager
  416. >there is only one low-level event queue (the place where _PostEvent puts
  417. >events), and the events there are always passed to the frontmost process. This
  418. >alone disallows the app1Evt technique, since by definition you'd be using it
  419. >when your process was not frontmost.
  420.  
  421. Not so!  You'll notice that the VBL checks to see if its owning application
  422. is frontmost.  If it is, then it will post the app1evt and check again for
  423. any changes 2 ticks later.  If it isn't frontmost, then my VBL does nothing,
  424. and checks again one second later.
  425.  
  426. Lawrence's suggestion is a great one (now that he mentions it, I remember
  427. reading the same caveat somewhere), and I'll implement it when I can find time
  428. this week.  I'll be posting the new, future-compatible version to the net
  429. soon, so don't implement VBL cursor-watching in your application yet unless
  430. you are sure that you don't want it to run under System 7.1.  (We know it
  431. works under System 7.0.1 and lower, but it's probably incompatible with
  432. higher system versions right now).
  433.  
  434. The new version will also have a change suggested by Sigurdur Asgeirsson.
  435.  
  436.     - Scott
  437.  
  438. ---------------------------
  439.  
  440. From: byrne@cc.gatech.edu (Michael Byrne)
  441. Subject: Restricting PBCatSearch
  442. Date: 17 Jul 92 06:03:07 GMT
  443. Organization: College of Computing
  444.  
  445. Okay, I must be missing something.  Every time I call PBCatSearch,
  446. it searches the entire volume--but I don't want the entire volume.
  447. For example, if I tell PBCatSearch to find all 'TEXT' files in
  448. a particular folder (and all its subfolders), it still searches the
  449. entire disk for 'TEXT' files, which in my case means it finds a
  450. zillion files--I only want it to find about ten.
  451.  
  452. I'm setting the ioVRefNum to the working directory number of 
  453. the directory I want searched--isn't that how it's supposed to work?
  454. Or does PBCatSearch *always* search the entire volume?
  455.  
  456. - -------------------------------------------------------------
  457. Mike Byrne                               byrne@cc.gatech.edu
  458. Grad student in Psychology/Cognitive Science
  459. 25947 GA Tech Station, Atlanta, GA 30332
  460.  
  461. - ----->>>>    "Only the mediocre are always at their best."
  462.                     
  463.  
  464. +++++++++++++++++++++++++++
  465.  
  466. From: keith@taligent.com (Keith Rollin)
  467. Date: 17 Jul 92 19:04:56 GMT
  468. Organization: Taligent
  469.  
  470. In article <1992Jul17.060307.2769@cc.gatech.edu>, byrne@cc.gatech.edu (Michael
  471. Byrne) writes:
  472. > Okay, I must be missing something.  Every time I call PBCatSearch,
  473. > it searches the entire volume--but I don't want the entire volume.
  474. > For example, if I tell PBCatSearch to find all 'TEXT' files in
  475. > a particular folder (and all its subfolders), it still searches the
  476. > entire disk for 'TEXT' files, which in my case means it finds a
  477. > zillion files--I only want it to find about ten.
  478. > I'm setting the ioVRefNum to the working directory number of 
  479. > the directory I want searched--isn't that how it's supposed to work?
  480. > Or does PBCatSearch *always* search the entire volume?
  481.  
  482. Yes, that's the way it works. Note the description on page 27-20 if IM VI:
  483. "PBCatSearch looks at all entries in all directories on a volume..." If you want
  484. to limit your searches to a single folder and its sub-folders, use the
  485. techniques shown in Technote #68.
  486.  
  487. - --
  488. Keith Rollin
  489. Phantom Programmer
  490. Taligent, Inc.
  491.  
  492.  
  493. +++++++++++++++++++++++++++
  494.  
  495. From: dougm@cns.caltech.edu (Doug McNaught)
  496. Organization: California Institute of Technology
  497. Date: Sun, 19 Jul 1992 03:55:33 GMT
  498.  
  499. In article <70165@apple.Apple.COM> keith@taligent.com (Keith Rollin) writes:
  500.  
  501.    In article <1992Jul17.060307.2769@cc.gatech.edu>, byrne@cc.gatech.edu (Michael
  502.    Byrne) writes:
  503.    > 
  504.    > Okay, I must be missing something.  Every time I call PBCatSearch,
  505.    > it searches the entire volume--but I don't want the entire volume.
  506.    > For example, if I tell PBCatSearch to find all 'TEXT' files in
  507.    > a particular folder (and all its subfolders), it still searches the
  508.    > entire disk for 'TEXT' files, which in my case means it finds a
  509.    > zillion files--I only want it to find about ten.
  510.    > 
  511.    > I'm setting the ioVRefNum to the working directory number of 
  512.    > the directory I want searched--isn't that how it's supposed to work?
  513.    > Or does PBCatSearch *always* search the entire volume?
  514.  
  515.    Yes, that's the way it works. Note the description on page 27-20 if IM VI:
  516.    "PBCatSearch looks at all entries in all directories on a volume..." If you want
  517.    to limit your searches to a single folder and its sub-folders, use the
  518.    techniques shown in Technote #68.
  519.  
  520.  Actually, you can restrict the search to a single directory using the
  521. ioFlParID field of the info record. It's not a recursive search,
  522. though--if you want to search a whole subtree you have to do an
  523. indexed search or call CatSearch for each subdirectory, etc...
  524. - -doug
  525. - --
  526. Doug McNaught              |"Sadder still to watch it die/ Then never to have
  527. dougm@cns.caltech.edu      | known it/ For you, the blind who once could see/
  528. doug@midget.towson.edu     | The bell tolls for thee..." --Neil Peart
  529.   Nobody approves my opinions! Not even me, sometimes. Read at your own risk.
  530.  
  531. ---------------------------
  532.  
  533. From: loomer@kiwi.ucsb.edu (Chinn)
  534. Subject: init help
  535. Date: 19 Jul 92 05:46:47 GMT
  536. Organization: University of California, Santa Barbara
  537.  
  538. Ok, this is my first attempt at using newgroups so I hope I've posted
  539. this properly.  Anyway I have a couple of questions I was hoping
  540. somebody out there might help me with.
  541. 1) I've written an INIT/CDEV.  The CDEV lets the user adjust a
  542. setting of the init so I want to be able to determine if the init was
  543. actually loaded and where in memory it is.  Currently I have the init
  544. save its location in the resource file.  The cdev can then check this
  545. location, look for my flags indicating that the location really has
  546. my init, then modify the variable.  Is there a better way to do this?
  547. 2)  I need to force a textedit to start displaying at the line of my
  548. choice.  I thought of TESelview() but it only insures that the given
  549. range is somewhere in the view rect, not necessarily the first line.
  550. Thanks for any info...
  551.  
  552. Paul Chinn         loomer@kiwi.ucsb.edu
  553.  
  554.  
  555. +++++++++++++++++++++++++++
  556.  
  557. From: resnick@cogsci.uiuc.edu (Pete Resnick)
  558. Organization: University of Illinois at Urbana
  559. Date: Sun, 19 Jul 1992 18:05:49 GMT
  560.  
  561. loomer@kiwi.ucsb.edu (Chinn) writes:
  562.  
  563. I only have an answer to question 1.
  564.  
  565. >1) I've written an INIT/CDEV.  The CDEV lets the user adjust a
  566. >setting of the init so I want to be able to determine if the init was
  567. >actually loaded and where in memory it is.  Currently I have the init
  568. >save its location in the resource file.  The cdev can then check this
  569. >location, look for my flags indicating that the location really has
  570. >my init, then modify the variable.  Is there a better way to do this?
  571.  
  572. Yes. Assuming you are running on System 6.0.5 or better, install a
  573. Gestalt selector which will return the address to your INIT. See
  574. Inside Mac VI for details on how to use the Gestalt Manager.
  575.  
  576. pr
  577. - --
  578. Pete Resnick             (...so what is a mojo, and why would one be rising?)
  579. Graduate assistant - Philosophy Department, Gregory Hall, UIUC
  580. System manager - Cognitive Science Group, Beckman Institute, UIUC
  581. Internet: resnick@cogsci.uiuc.edu
  582.  
  583. ---------------------------
  584.  
  585. From: braun-eric@CS.YALE.EDU (Eric E. Braun)
  586. Subject: How to modify SFGet(Put)File buttons.
  587. Organization: Yale University Computer Science Dept., New Haven, CT 06520-2158
  588. Date: Wed, 15 Jul 1992 15:13:11 GMT
  589.  
  590. Hi,
  591.  
  592. How does one go about setting a button title in the standard getfile
  593. and putfile windows?  (Pre System 7)
  594.  
  595. Thanks in advance.
  596.  
  597. Eric
  598.  
  599. - -- 
  600. - -------------------------------------------------------------------------------
  601. Eric E. Braun                        braun@zoo.cs.yale.edu
  602.  
  603. +++++++++++++++++++++++++++
  604.  
  605. From: CHARLESW@QUCDN.QueensU.CA
  606. Date: 16 Jul 92 00:54:13 GMT
  607. Organization: Queen's University at Kingston
  608.  
  609.  
  610.   Have a look at Apple's Sample Code 18.  It demonstrates lots of the things
  611. you want to do with the Standard File dialogs.  Oh yes, check that you've got
  612. the second version (May/90?)--the first version was okay but the second is
  613. much better (I'm not sure who did it.  As I recall, there's no credit).
  614.  
  615.   Cheers,
  616.  
  617. .../dave   Dave Charlesworth
  618.  
  619. +++++++++++++++++++++++++++
  620.  
  621. From: keith@taligent.com (Keith Rollin)
  622. Date: 16 Jul 92 20:28:15 GMT
  623. Organization: Taligent
  624.  
  625. In article <92197.205413CHARLESW@QUCDN.QueensU.CA>, CHARLESW@QUCDN.QueensU.CA
  626. writes:
  627. >Have a look at Apple's Sample Code 18. It demonstrates lots of the things
  628. >you want to do with the Standard File dialogs. Oh yes, check that you've got
  629. >the second version (May/90?)--the first version was okay but the second is
  630. >much better (I'm not sure who did it.  As I recall, there's no credit).
  631. >
  632.  
  633. I did the first version (it was one of my first programs for the Mac). Jim
  634. Reekes, Sound Maven, gave it a bath and released the second version.
  635.  
  636. However, I don't recall that either version answers the original poster's
  637. question. But I could be wrong.
  638.  
  639. - --
  640. Keith Rollin
  641. Phantom Programmer
  642. Taligent, Inc.
  643.  
  644.  
  645. +++++++++++++++++++++++++++
  646.  
  647. From: wirehead@cheshire.oxy.edu (David J. Harr)
  648. Organization: The Programmers who say NEE!
  649. Date: Sun, 19 Jul 1992 00:04:40 GMT
  650.  
  651. As an aside, all you up and coming custom open/save dialog box creators
  652. should be aware of a gotcha in SFPGetFile. It doesn't support tabbing
  653. between text edit items you add to the dialog. I had a custom dialog
  654. wherein the user had several edit text items they could type into in
  655. the dialog. For some reason, you could not tab around then properly.
  656. No matter what I did, I could find no problems in my code. I 'linked
  657. DTS, and they informed me that that was an "Unimplemented feature
  658. that was unlikely to ever be retofitted" to the routine. They suggested
  659. I use the new System 7 routines instead. I would, if my app were to
  660. run under System 7. Anyway, I have never seen that documented anywhere,
  661. so I thought I'd throw it out.
  662.  
  663. David.
  664.  
  665. "This is a job for STUPOR DUCK!!" (fanfare).
  666.  
  667.  
  668. +++++++++++++++++++++++++++
  669.  
  670. From: keith@taligent.com (Keith Rollin)
  671. Date: 19 Jul 92 22:35:38 GMT
  672. Organization: Taligent
  673.  
  674. In article <1992Jul19.000440.11497@cheshire.oxy.edu>, wirehead@cheshire.oxy.edu
  675. (David J. Harr) writes:
  676. > As an aside, all you up and coming custom open/save dialog box creators
  677. > should be aware of a gotcha in SFPGetFile. It doesn't support tabbing
  678. > between text edit items you add to the dialog. I had a custom dialog
  679. > wherein the user had several edit text items they could type into in
  680. > the dialog. For some reason, you could not tab around then properly.
  681. > No matter what I did, I could find no problems in my code. I 'linked
  682. > DTS, and they informed me that that was an "Unimplemented feature
  683. > that was unlikely to ever be retofitted" to the routine. They suggested
  684. > I use the new System 7 routines instead. I would, if my app were to
  685. > run under System 7. Anyway, I have never seen that documented anywhere,
  686. > so I thought I'd throw it out.
  687.  
  688. Could you tell us what you tried? Until I left, I used to be the engineer in DTS
  689. that handled all the Standard File questions. Off the top of my head, I can't
  690. think of anything that would prevent you from adding tabbing. Unless Standard
  691. File is continually setting the editText item (which I don't think it is), you
  692. should be able to do what you want, even if it means munging with the itemH and
  693. editField fields of the dialog record yourself, posting your own mouse down
  694. events, or returning the appropriate item numbers from the dlgHook or
  695. filterProc.
  696.  
  697. - --
  698. Keith Rollin
  699. Phantom Programmer
  700. Taligent, Inc.
  701.  
  702.  
  703. +++++++++++++++++++++++++++
  704.  
  705. From: wirehead@cheshire.oxy.edu (David J. Harr)
  706. Organization: The programmers who say NEE!
  707. Date: Mon, 20 Jul 1992 01:30:15 GMT
  708.  
  709. In article <70227@apple.Apple.COM> keith@taligent.com (Keith Rollin) writes:
  710. >
  711. >> [my comments about SFPGetFile deleted for brevity]
  712. >
  713. >Could you tell us what you tried? Until I left, I used to be the engineer in DTS
  714. >that handled all the Standard File questions. Off the top of my head, I can't
  715. >think of anything that would prevent you from adding tabbing. Unless Standard
  716. >File is continually setting the editText item (which I don't think it is), you
  717. >should be able to do what you want, even if it means munging with the itemH and
  718. >editField fields of the dialog record yourself, posting your own mouse down
  719. >events, or returning the appropriate item numbers from the dlgHook or
  720. >filterProc.
  721. >
  722. >--
  723. >Keith Rollin
  724. >Phantom Programmer
  725. >Taligent, Inc.
  726. >
  727.  
  728. OK, I had about eight edittext items in the dialog. When you tried to tab
  729. among them, the system would only select as many characters as were in the
  730. lowest numbered edittext item. For example, if the first field had only
  731. three letters in it and the second field had seven, it would only select
  732. the first three letters in the second field. I said to myself "Self, this
  733. is no problem, I'll just write a custom filter proc, and if the key event
  734. is a tab, then I'll just select the entire edittext field by brute force
  735. by checking the editField and then doing a SelIText on the whole mess."
  736. Well, that was a good idea, but it turns out there is NO WAY to get a tab
  737. keypress out of SFPGetFile. I even used a DLOG resource number other than
  738. - -4000 to ensure that I would get keyDown events. However, no matter how I
  739. worked it, I never could get a tab keyDown event from the system, so that
  740. pretty much sunk that theory. Another interesting symptom was that sometimes
  741. the system would "lose its way", ie even though I tabbed, there would be no
  742. edittext item highlighted, and sometimes it would even skip around and have
  743. more than one editext field highlighted at the same time. All in all, very
  744. bizarre behavior.
  745.  
  746. David.
  747.  
  748. "My definition of happiness is being famous for your financial ability
  749.  to indulge in every form of excess." -- Calvin.
  750.  
  751.  
  752.  
  753. +++++++++++++++++++++++++++
  754.  
  755. Organization: Queen's University at Kingston
  756. Date: Sunday, 19 Jul 1992 22:49:42 EDT
  757. From: <CHARLESW@QUCDN.QueensU.CA>
  758.  
  759. > However, I don't recall that either version answers the original poster's
  760. > question. But I could be wrong.
  761.  
  762. Ooops, you're right!  (I could have sworn that was in there.  Well, there are
  763. still lots of good examples of things you'll want to do with SF*File.  I hope
  764. DTS has the time to add to the Sample Code because I've found them useful.)
  765.  
  766. .../dave   Dave Charlesworth
  767.  
  768. ---------------------------
  769.  
  770. End of C.S.M.P. Digest
  771. **********************
  772.